Skip to content

feat(forward): collect per-rule metrics and interfaces#692

Closed
kt0ns wants to merge 11 commits intomainfrom
feat/per-rule-metrics-and-interfaces
Closed

feat(forward): collect per-rule metrics and interfaces#692
kt0ns wants to merge 11 commits intomainfrom
feat/per-rule-metrics-and-interfaces

Conversation

@kt0ns
Copy link
Copy Markdown
Collaborator

@kt0ns kt0ns commented Apr 29, 2026

No description provided.

Copilot AI review requested due to automatic review settings April 29, 2026 08:25
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends the forward control-plane to expose metrics via gRPC and refactors the controlplane FFI DPConfig surface toward interfaces, while adding a new NIC counters retrieval path that wires through the C agent/Go FFI.

Changes:

  • Add ForwardService.GetMetrics RPC and a forward metrics collector.
  • Introduce FFI interfaces (FFIAgent, DPConfig, etc.) and adjust call sites to use interface-based DPConfig handles.
  • Add NIC counters plumbing (dataplane worker-side NIC stat export + controlplane agent/FFI APIs to fetch NIC counters).

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 13 comments.

Show a summary per file
File Description
modules/forward/controlplane/service.go Adds GetMetrics gRPC handler calling forward metric collection.
modules/forward/controlplane/metrics.go New forward metrics collector (currently using wrong module type / filtering).
modules/forward/controlplane/service_test.go Updates mock backend for new Backend.Agent() method (currently doesn’t compile).
modules/forward/controlplane/forwardpb/forward.proto Adds GetMetrics RPC and Metric proto dependency.
modules/forward/controlplane/backend.go Exposes underlying FFI agent via Backend.Agent().
controlplane/ffi/shm.go Introduces DPConfig/agent interface types; DPConfig now returned as an interface; adds NicCounters.
controlplane/ffi/agent.go Introduces FFIAgent interfaces and updates Agent.DPConfig() to return the interface type.
controlplane/internal/gateway/inspect_service.go Updates helper signatures to accept ffi.DPConfig interface instead of pointer.
modules/balancer/agent/go/ffi/agent.go Updates DPConfig() return type to the new interface type.
controlplane/ynpb/counters.proto Adds Nic RPC and request message (server handler not implemented).
api/counter.h Declares new yanet_get_nic_counters C API.
lib/controlplane/config/zone.h Adds cp_config_gen_get_nic_counter_storage alias (currently mapped to device storage).
lib/controlplane/agent/agent.c Implements yanet_get_nic_counters (currently returns malformed lists when filtered).
lib/dataplane/config/zone.h Extends dp_worker with NIC counter pointers.
dataplane/worker.c Adds periodic NIC stats sampling and registers new worker counters; refactors worker counter wiring.
dataplane/dataplane.c Comments out legacy rte_eth_stats logging in stat_thread.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread dataplane/worker.c Outdated
Comment thread dataplane/worker.c
Comment thread dataplane/worker.c
Comment thread dataplane/worker.c Outdated
Comment thread controlplane/ffi/shm.go
Comment thread controlplane/ynpb/counters.proto Outdated
Comment on lines +198 to +202
func (m *ForwardService) GetMetrics(
ctx context.Context,
req *forwardpb.GetMetricsRequest,
) (*forwardpb.GetMetricsResponse, error) {
m.mu.Lock()
Comment thread modules/forward/controlplane/service_test.go
Comment on lines +29 to +32
func (m *ForwardService) collectMetrics() ([]*commonpb.Metric, error) {
dpConfig := m.backend.Agent().DPConfig()
positions := dpConfig.AllModulePositions("acl")

Comment thread modules/forward/controlplane/metrics.go
@kt0ns kt0ns closed this Apr 29, 2026
@kt0ns
Copy link
Copy Markdown
Collaborator Author

kt0ns commented Apr 29, 2026

reopen 694

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants